// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
  //端口设置
  devServer: {
    port: 4098,
  },
  //运行时配置
  runtimeConfig: {
    apiSecret: '123',
    public: {
      baseUrl: process.env.NUXT_PUBLIC_API_BASE,
    },
  },
  //nitro
  nitro: {
    // devProxy: {
    //   "/api": {
    //     target: 'http://127.0.0.1:9999',
    //     changeOrigin: true,
    //   }
    // }
  },
  app: {
    // head
    head: {
      title: 'myapp',
      meta: [
        { name: 'viewport', content: 'width=device-width, initial-scale=1' },
        {
          hid: 'description',
          name: 'description',
          content: 'myapp',
        },
      ],
      //全局样式和脚本 
      link: [{ rel: 'icon', type: 'image/x-icon', href: '/favicon.ico' }],
      script: [{
        type: 'text/javascript',
        src: 'https://webapi.amap.com/maps?v=2.0&key=6873c6758b14cda114b22c28c6fd13d4'
      }]
    }
  },
  //typescript
  typescript: {
    strict: true,
    shim: false,
  },
  //开启开发工具
  devtools: { enabled: false },
  //build  modules
  modules: [
    '@element-plus/nuxt',
    '@vueuse/nuxt',
    '@unocss/nuxt',
    '@pinia/nuxt', ,
    '@nuxtjs/color-mode'
  ],
  //css
  css: ['~/assets/scss/index.scss'],
  vite: {
    css: {
      preprocessorOptions: {
        scss: {
          additionalData: `@use "@/assets/scss/element/index.scss" as element;`,
        },
      },
    },
  },
  // vueuse
  vueuse: {
    ssrHandlers: true,
  },
  // unocss
  unocss: {
    uno: true,
    attributify: true,
    icons: {
      scale: 1.2,
    },
  },
  // colorMode
  colorMode: {
    classSuffix: '',
  },
  //elementPlus
  elementPlus: {
    //图标前缀
    icon: '',
    importStyle: 'scss',
    themes: ['dark'],
  },
})

